<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>商品详情页面 | 美多商城</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../C03-Goods/HotSaleGoods.html" />
    
    
    <link rel="prev" href="../C03-Goods/GenerateIndexHTMLScript.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="3.11"
        data-chapter-title="商品详情页面"
        data-filepath="C03-Goods/GoodsDetail.md"
        data-basepath=".."
        data-revision="Thu May 24 2018 15:58:46 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        美多商城
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="C01-Prepare/index.html">
            
                
                    <a href="../C01-Prepare/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        项目准备
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="C01-Prepare/BusinessModel.html">
            
                
                    <a href="../C01-Prepare/BusinessModel.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        商业模式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="C01-Prepare/DevelopmentProcess.html">
            
                
                    <a href="../C01-Prepare/DevelopmentProcess.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        开发流程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="C01-Prepare/ProductAnalysis.html">
            
                
                    <a href="../C01-Prepare/ProductAnalysis.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        需求分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="C01-Prepare/ProjectStructure.html">
            
                
                    <a href="../C01-Prepare/ProjectStructure.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        项目架构
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="C01-Prepare/StartProject.html">
            
                
                    <a href="../C01-Prepare/StartProject.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        创建工程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="C01-Prepare/Config.html">
            
                
                    <a href="../C01-Prepare/Config.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        配置
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="C02-Users/index.html">
            
                
                    <a href="../C02-Users/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        用户部分
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="C02-Users/UserModel.html">
            
                
                    <a href="../C02-Users/UserModel.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        用户模型类
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="C02-Users/Register.html">
            
                
                    <a href="../C02-Users/Register.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        注册
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="C02-Users/CORS.html">
            
                
                    <a href="../C02-Users/CORS.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        跨域CORS
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="C02-Users/JWT.html">
            
                
                    <a href="../C02-Users/JWT.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        JWT
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="C02-Users/DRF-JWT.html">
            
                
                    <a href="../C02-Users/DRF-JWT.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        Django REST framework JWT
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="C02-Users/Login.html">
            
                
                    <a href="../C02-Users/Login.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        登录
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="C02-Users/FindPassword/index.html">
            
                
                    <a href="../C02-Users/FindPassword/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        找回密码
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.7.1" data-path="C02-Users/FindPassword/Step1.html">
            
                
                    <a href="../C02-Users/FindPassword/Step1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.1.</b>
                        
                        第一步
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7.2" data-path="C02-Users/FindPassword/Step2.html">
            
                
                    <a href="../C02-Users/FindPassword/Step2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.2.</b>
                        
                        第二步
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7.3" data-path="C02-Users/FindPassword/Step3.html">
            
                
                    <a href="../C02-Users/FindPassword/Step3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.3.</b>
                        
                        第三步
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7.4" data-path="C02-Users/FindPassword/Step4.html">
            
                
                    <a href="../C02-Users/FindPassword/Step4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.4.</b>
                        
                        第四步
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="C02-Users/QQLogin/index.html">
            
                
                    <a href="../C02-Users/QQLogin/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        QQ登录
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.8.1" data-path="C02-Users/QQLogin/Step1.html">
            
                
                    <a href="../C02-Users/QQLogin/Step1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.1.</b>
                        
                        第一步
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8.2" data-path="C02-Users/QQLogin/Step2.html">
            
                
                    <a href="../C02-Users/QQLogin/Step2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.2.</b>
                        
                        第二步
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8.3" data-path="C02-Users/QQLogin/Step3.html">
            
                
                    <a href="../C02-Users/QQLogin/Step3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.3.</b>
                        
                        第三步
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="C02-Users/UserInfo.html">
            
                
                    <a href="../C02-Users/UserInfo.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        用户中心个人信息
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="C02-Users/Email/index.html">
            
                
                    <a href="../C02-Users/Email/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.</b>
                        
                        邮件与验证
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.10.1" data-path="C02-Users/Email/DjangoEmail.html">
            
                
                    <a href="../C02-Users/Email/DjangoEmail.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.1.</b>
                        
                        Django发送邮件的方法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10.2" data-path="C02-Users/Email/SendEmail.html">
            
                
                    <a href="../C02-Users/Email/SendEmail.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.2.</b>
                        
                        保存邮箱并发送验证邮件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10.3" data-path="C02-Users/Email/VerifyEmail.html">
            
                
                    <a href="../C02-Users/Email/VerifyEmail.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.3.</b>
                        
                        验证邮箱链接
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="C02-Users/Address/index.html">
            
                
                    <a href="../C02-Users/Address/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.</b>
                        
                        收货地址
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.11.1" data-path="C02-Users/Address/AreaSelect.html">
            
                
                    <a href="../C02-Users/Address/AreaSelect.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.1.</b>
                        
                        省市区地址查询
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.11.2" data-path="C02-Users/Address/Cache.html">
            
                
                    <a href="../C02-Users/Address/Cache.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.2.</b>
                        
                        使用缓存
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.11.3" data-path="C02-Users/Address/UserAddressManagement.html">
            
                
                    <a href="../C02-Users/Address/UserAddressManagement.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.3.</b>
                        
                        用户地址管理
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="C03-Goods/index.html">
            
                
                    <a href="../C03-Goods/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        商品部分
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="C03-Goods/DatabaseDesign.html">
            
                
                    <a href="../C03-Goods/DatabaseDesign.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        数据表设计
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="C03-Goods/FastDFS.html">
            
                
                    <a href="../C03-Goods/FastDFS.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        FastDFS分布式文件系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="C03-Goods/Docker/index.html">
            
                
                    <a href="../C03-Goods/Docker/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        Docker使用
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.3.1" data-path="C03-Goods/Docker/Introduce.html">
            
                
                    <a href="../C03-Goods/Docker/Introduce.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.1.</b>
                        
                        Docker简介
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3.2" data-path="C03-Goods/Docker/InstallAndOperations.html">
            
                
                    <a href="../C03-Goods/Docker/InstallAndOperations.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.2.</b>
                        
                        安装与操作
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="C03-Goods/FastDFSDocker.html">
            
                
                    <a href="../C03-Goods/FastDFSDocker.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        使用Docker安装FastDFS
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="C03-Goods/FastDFSClientAndDjangoFileSystem.html">
            
                
                    <a href="../C03-Goods/FastDFSClientAndDjangoFileSystem.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        FastDFS客户端与自定义文件存储系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="C03-Goods/CKEditor.html">
            
                
                    <a href="../C03-Goods/CKEditor.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        CKEditor富文本编辑器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="C03-Goods/ImportGoodsData.html">
            
                
                    <a href="../C03-Goods/ImportGoodsData.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        添加测试数据
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="C03-Goods/FreezeHTML.html">
            
                
                    <a href="../C03-Goods/FreezeHTML.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.8.</b>
                        
                        页面静态化
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="C03-Goods/DjangoCrontab.html">
            
                
                    <a href="../C03-Goods/DjangoCrontab.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.9.</b>
                        
                        定时任务
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.10" data-path="C03-Goods/GenerateIndexHTMLScript.html">
            
                
                    <a href="../C03-Goods/GenerateIndexHTMLScript.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.10.</b>
                        
                        静态化首页的手动脚本
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="3.11" data-path="C03-Goods/GoodsDetail.html">
            
                
                    <a href="../C03-Goods/GoodsDetail.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.11.</b>
                        
                        商品详情页面
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.12" data-path="C03-Goods/HotSaleGoods.html">
            
                
                    <a href="../C03-Goods/HotSaleGoods.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.12.</b>
                        
                        热销商品
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.13" data-path="C03-Goods/UserBrowseHistory.html">
            
                
                    <a href="../C03-Goods/UserBrowseHistory.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.13.</b>
                        
                        用户浏览历史记录
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.14" data-path="C03-Goods/GoodsList.html">
            
                
                    <a href="../C03-Goods/GoodsList.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.14.</b>
                        
                        商品列表页
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.15" data-path="C03-Goods/GoodsSearch.html">
            
                
                    <a href="../C03-Goods/GoodsSearch.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.15.</b>
                        
                        商品搜索
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="C04-Cart/index.html">
            
                
                    <a href="../C04-Cart/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        购物车部分
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="C04-Cart/DataStructureDesign.html">
            
                
                    <a href="../C04-Cart/DataStructureDesign.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        购物车数据存储设计
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="C04-Cart/Implement.html">
            
                
                    <a href="../C04-Cart/Implement.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        购物车实现
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="C04-Cart/MergeCart.html">
            
                
                    <a href="../C04-Cart/MergeCart.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        登录合并购物车
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="C05-Order/index.html">
            
                
                    <a href="../C05-Order/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        订单部分
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="C05-Order/OrderDBModel.html">
            
                
                    <a href="../C05-Order/OrderDBModel.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        订单数据库设计
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="C05-Order/PlaceOrder.html">
            
                
                    <a href="../C05-Order/PlaceOrder.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        订单结算
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="C05-Order/SaveOrder.html">
            
                
                    <a href="../C05-Order/SaveOrder.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        保存订单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="C05-Order/OrderSuccess.html">
            
                
                    <a href="../C05-Order/OrderSuccess.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        下单成功
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="C06-Pay/index.html">
            
                
                    <a href="../C06-Pay/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        支付宝支付
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="C06-Pay/Alipay.html">
            
                
                    <a href="../C06-Pay/Alipay.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        接入支付宝
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="C06-Pay/Paying.html">
            
                
                    <a href="../C06-Pay/Paying.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        发起支付
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="C06-Pay/PaymentResult.html">
            
                
                    <a href="../C06-Pay/PaymentResult.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        保存支付结果
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7" data-path="C07-Xadmin.html">
            
                
                    <a href="../C07-Xadmin.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        Xadmin
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8" data-path="C08-Permission.html">
            
                
                    <a href="../C08-Permission.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        用户权限控制
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9" data-path="C09-Database/index.html">
            
                
                    <a href="../C09-Database/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                        数据库读写分离
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1" data-path="C09-Database/MasterSlave.html">
            
                
                    <a href="../C09-Database/MasterSlave.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.1.</b>
                        
                        主从同步配置
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9.2" data-path="C09-Database/ReadWriteSeparate.html">
            
                
                    <a href="../C09-Database/ReadWriteSeparate.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.2.</b>
                        
                        Django数据库读写分离
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10" data-path="C10-Deploy.html">
            
                
                    <a href="../C10-Deploy.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.</b>
                        
                        Django部署
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >美多商城</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x5546;&#x54C1;&#x8BE6;&#x60C5;&#x9875;">&#x5546;&#x54C1;&#x8BE6;&#x60C5;&#x9875;</h1>
<p>&#x5546;&#x54C1;&#x8BE6;&#x60C5;&#x9875;&#x4F9D;&#x7136;&#x91C7;&#x7528;&#x9875;&#x9762;&#x9759;&#x6001;&#x5316;&#x6280;&#x672F;&#x3002;</p>
<p>&#x5546;&#x54C1;&#x8BE6;&#x60C5;&#x9875;&#x7684;&#x9759;&#x6001;&#x5316;&#x7531;&#x8FD0;&#x8425;&#x4EBA;&#x5458;&#x5728;&#x7F16;&#x8F91;&#x5546;&#x54C1;&#x4FE1;&#x606F;&#x65F6;&#x89E6;&#x53D1;&#x751F;&#x6210;&#x9759;&#x6001;&#x5316;&#x9875;&#x9762;&#x3002;</p>
<p>&#x5148;&#x6765;&#x5B9E;&#x73B0;&#x9759;&#x6001;&#x5316;&#x5F02;&#x6B65;&#x4EFB;&#x52A1;&#xFF0C;&#x5728;celery_tasks&#x4E2D;&#x65B0;&#x5EFA;html/tasks.py&#x4EFB;&#x52A1;</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> celery_tasks.main <span class="hljs-keyword">import</span> app
<span class="hljs-keyword">from</span> django.template <span class="hljs-keyword">import</span> loader
<span class="hljs-keyword">from</span> django.conf <span class="hljs-keyword">import</span> settings
<span class="hljs-keyword">import</span> os

<span class="hljs-keyword">from</span> goods.utils <span class="hljs-keyword">import</span> get_categories
<span class="hljs-keyword">from</span> goods.models <span class="hljs-keyword">import</span> SKU


<span class="hljs-decorator">@app.task(name=&apos;generate_static_sku_detail_html&apos;)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">generate_static_sku_detail_html</span><span class="hljs-params">(sku_id)</span>:</span>
    <span class="hljs-string">&quot;&quot;&quot;
    &#x751F;&#x6210;&#x9759;&#x6001;&#x5546;&#x54C1;&#x8BE6;&#x60C5;&#x9875;&#x9762;
    :param sku_id: &#x5546;&#x54C1;sku id
    &quot;&quot;&quot;</span>
    <span class="hljs-comment"># &#x5546;&#x54C1;&#x5206;&#x7C7B;&#x83DC;&#x5355;</span>
    categories = get_categories()

    <span class="hljs-comment"># &#x83B7;&#x53D6;&#x5F53;&#x524D;sku&#x7684;&#x4FE1;&#x606F;</span>
    sku = SKU.objects.get(id=sku_id)
    sku.images = sku.skuimage_set.all()

    <span class="hljs-comment"># &#x9762;&#x5305;&#x5C51;&#x5BFC;&#x822A;&#x4FE1;&#x606F;&#x4E2D;&#x7684;&#x9891;&#x9053;</span>
    goods = sku.goods
    goods.channel = goods.category1.goodschannel_set.all()[<span class="hljs-number">0</span>]

    <span class="hljs-comment"># &#x6784;&#x5EFA;&#x5F53;&#x524D;&#x5546;&#x54C1;&#x7684;&#x89C4;&#x683C;&#x952E;</span>
    <span class="hljs-comment"># sku_key = [&#x89C4;&#x683C;1&#x53C2;&#x6570;id&#xFF0C; &#x89C4;&#x683C;2&#x53C2;&#x6570;id&#xFF0C; &#x89C4;&#x683C;3&#x53C2;&#x6570;id, ...]</span>
    sku_specs = sku.skuspecification_set.order_by(<span class="hljs-string">&apos;spec_id&apos;</span>)
    sku_key = []
    <span class="hljs-keyword">for</span> spec <span class="hljs-keyword">in</span> sku_specs:
        sku_key.append(spec.option.id)

    <span class="hljs-comment"># &#x83B7;&#x53D6;&#x5F53;&#x524D;&#x5546;&#x54C1;&#x7684;&#x6240;&#x6709;SKU</span>
    skus = goods.sku_set.all()

    <span class="hljs-comment"># &#x6784;&#x5EFA;&#x4E0D;&#x540C;&#x89C4;&#x683C;&#x53C2;&#x6570;&#xFF08;&#x9009;&#x9879;&#xFF09;&#x7684;sku&#x5B57;&#x5178;</span>
    <span class="hljs-comment"># spec_sku_map = {</span>
    <span class="hljs-comment">#     (&#x89C4;&#x683C;1&#x53C2;&#x6570;id, &#x89C4;&#x683C;2&#x53C2;&#x6570;id, &#x89C4;&#x683C;3&#x53C2;&#x6570;id, ...): sku_id,</span>
    <span class="hljs-comment">#     (&#x89C4;&#x683C;1&#x53C2;&#x6570;id, &#x89C4;&#x683C;2&#x53C2;&#x6570;id, &#x89C4;&#x683C;3&#x53C2;&#x6570;id, ...): sku_id,</span>
    <span class="hljs-comment">#     ...</span>
    <span class="hljs-comment"># }</span>
    spec_sku_map = {}
    <span class="hljs-keyword">for</span> s <span class="hljs-keyword">in</span> skus:
        <span class="hljs-comment"># &#x83B7;&#x53D6;sku&#x7684;&#x89C4;&#x683C;&#x53C2;&#x6570;</span>
        s_specs = s.skuspecification_set.order_by(<span class="hljs-string">&apos;spec_id&apos;</span>)
        <span class="hljs-comment"># &#x7528;&#x4E8E;&#x5F62;&#x6210;&#x89C4;&#x683C;&#x53C2;&#x6570;-sku&#x5B57;&#x5178;&#x7684;&#x952E;</span>
        key = []
        <span class="hljs-keyword">for</span> spec <span class="hljs-keyword">in</span> s_specs:
            key.append(spec.option.id)
        <span class="hljs-comment"># &#x5411;&#x89C4;&#x683C;&#x53C2;&#x6570;-sku&#x5B57;&#x5178;&#x6DFB;&#x52A0;&#x8BB0;&#x5F55;</span>
        spec_sku_map[tuple(key)] = s.id

    <span class="hljs-comment"># &#x83B7;&#x53D6;&#x5F53;&#x524D;&#x5546;&#x54C1;&#x7684;&#x89C4;&#x683C;&#x4FE1;&#x606F;</span>
    <span class="hljs-comment">#specs = [</span>
    <span class="hljs-comment">#    {</span>
    <span class="hljs-comment">#        &apos;name&apos;: &apos;&#x5C4F;&#x5E55;&#x5C3A;&#x5BF8;&apos;,</span>
    <span class="hljs-comment">#        &apos;options&apos;: [</span>
    <span class="hljs-comment">#            {&apos;value&apos;: &apos;13.3&#x5BF8;&apos;, &apos;sku_id&apos;: xxx},</span>
    <span class="hljs-comment">#            {&apos;value&apos;: &apos;15.4&#x5BF8;&apos;, &apos;sku_id&apos;: xxx},</span>
    <span class="hljs-comment">#        ]</span>
    <span class="hljs-comment">#    },</span>
    <span class="hljs-comment">#    {</span>
    <span class="hljs-comment">#        &apos;name&apos;: &apos;&#x989C;&#x8272;&apos;,</span>
    <span class="hljs-comment">#        &apos;options&apos;: [</span>
    <span class="hljs-comment">#            {&apos;value&apos;: &apos;&#x94F6;&#x8272;&apos;, &apos;sku_id&apos;: xxx},</span>
    <span class="hljs-comment">#            {&apos;value&apos;: &apos;&#x9ED1;&#x8272;&apos;, &apos;sku_id&apos;: xxx}</span>
    <span class="hljs-comment">#        ]</span>
    <span class="hljs-comment">#    },</span>
    <span class="hljs-comment">#    ...</span>
    <span class="hljs-comment">#]</span>
    specs = goods.goodsspecification_set.order_by(<span class="hljs-string">&apos;id&apos;</span>)
    <span class="hljs-comment"># &#x82E5;&#x5F53;&#x524D;sku&#x7684;&#x89C4;&#x683C;&#x4FE1;&#x606F;&#x4E0D;&#x5B8C;&#x6574;&#xFF0C;&#x5219;&#x4E0D;&#x518D;&#x7EE7;&#x7EED;</span>
    <span class="hljs-keyword">if</span> len(sku_key) &lt; len(specs):
        <span class="hljs-keyword">return</span>
    <span class="hljs-keyword">for</span> index, spec <span class="hljs-keyword">in</span> enumerate(specs):
        <span class="hljs-comment"># &#x590D;&#x5236;&#x5F53;&#x524D;sku&#x7684;&#x89C4;&#x683C;&#x952E;</span>
        key = sku_key[:]
        <span class="hljs-comment"># &#x8BE5;&#x89C4;&#x683C;&#x7684;&#x9009;&#x9879;</span>
        options = spec.specificationoption_set.all()
        <span class="hljs-keyword">for</span> option <span class="hljs-keyword">in</span> options:
            <span class="hljs-comment"># &#x5728;&#x89C4;&#x683C;&#x53C2;&#x6570;sku&#x5B57;&#x5178;&#x4E2D;&#x67E5;&#x627E;&#x7B26;&#x5408;&#x5F53;&#x524D;&#x89C4;&#x683C;&#x7684;sku</span>
            key[index] = option.id
            option.sku_id = spec_sku_map.get(tuple(key))

        spec.options = options

    <span class="hljs-comment"># &#x6E32;&#x67D3;&#x6A21;&#x677F;&#xFF0C;&#x751F;&#x6210;&#x9759;&#x6001;html&#x6587;&#x4EF6;</span>
    context = {
        <span class="hljs-string">&apos;categories&apos;</span>: categories,
        <span class="hljs-string">&apos;goods&apos;</span>: goods,
        <span class="hljs-string">&apos;specs&apos;</span>: specs,
        <span class="hljs-string">&apos;sku&apos;</span>: sku
    }

    template = loader.get_template(<span class="hljs-string">&apos;detail.html&apos;</span>)
    html_text = template.render(context)
    file_path = os.path.join(settings.GENERATED_STATIC_HTML_FILES_DIR, <span class="hljs-string">&apos;goods/&apos;</span>+str(sku_id)+<span class="hljs-string">&apos;.html&apos;</span>)
    <span class="hljs-keyword">with</span> open(file_path, <span class="hljs-string">&apos;w&apos;</span>) <span class="hljs-keyword">as</span> f:
        f.write(html_text)
</code></pre>
<h4 id="&#x5173;&#x4E8E;&#x5F62;&#x6210;&#x5546;&#x54C1;&#x89C4;&#x683C;&#x9009;&#x9879;&#x6570;&#x636E;&#x7684;&#x601D;&#x8DEF;&#x8BF4;&#x660E;">&#x5173;&#x4E8E;&#x5F62;&#x6210;&#x5546;&#x54C1;&#x89C4;&#x683C;&#x9009;&#x9879;&#x6570;&#x636E;&#x7684;&#x601D;&#x8DEF;&#x8BF4;&#x660E;</h4>
<p><img src="../images/&#x89C4;&#x683C;&#x9009;&#x9879;.png" alt="&#x89C4;&#x683C;&#x9009;&#x9879;"></p>
<p>1&#xFF09;&#x6700;&#x7EC8;&#x60F3;&#x8981;&#x751F;&#x6210;&#x7684;&#x6A21;&#x677F;&#x5B57;&#x5178;&#x4E3A;&#xFF1A;</p>
<pre><code class="lang-python">specs = [
    {
        <span class="hljs-string">&apos;name&apos;</span>: <span class="hljs-string">&apos;&#x5C4F;&#x5E55;&#x5C3A;&#x5BF8;&apos;</span>,
        <span class="hljs-string">&apos;options&apos;</span>: [
            {<span class="hljs-string">&apos;id&apos;</span>: xxx, <span class="hljs-string">&apos;value&apos;</span>: <span class="hljs-string">&apos;13.3&#x5BF8;&apos;</span>, <span class="hljs-string">&apos;sku_id&apos;</span>: xxx},
            {<span class="hljs-string">&apos;id&apos;</span>: xxx, <span class="hljs-string">&apos;value&apos;</span>: <span class="hljs-string">&apos;15.4&#x5BF8;&apos;</span>, <span class="hljs-string">&apos;sku_id&apos;</span>: xxx},
        ]
    },
    {
        <span class="hljs-string">&apos;name&apos;</span>: <span class="hljs-string">&apos;&#x989C;&#x8272;&apos;</span>,
        <span class="hljs-string">&apos;options&apos;</span>: [
            {<span class="hljs-string">&apos;id&apos;</span>: xxx, <span class="hljs-string">&apos;value&apos;</span>: <span class="hljs-string">&apos;&#x94F6;&#x8272;&apos;</span>, <span class="hljs-string">&apos;sku_id&apos;</span>: xxx},
            {<span class="hljs-string">&apos;id&apos;</span>: xxx, <span class="hljs-string">&apos;value&apos;</span>: <span class="hljs-string">&apos;&#x9ED1;&#x8272;&apos;</span>, <span class="hljs-string">&apos;sku_id&apos;</span>: xxx}
        ]
    },
    ...
]
</code></pre>
<p>2&#xFF09;&#x5982;&#x4F55;&#x786E;&#x5B9A;&#x6BCF;&#x4E2A;value &#x4E0E; sku_id &#x7684;&#x5BF9;&#x5E94;&#x5173;&#x7CFB;&#xFF1F;</p>
<p>&#x786E;&#x5B9A;&#x6BCF;&#x4E2A;sku&#x7684;&#x5B8C;&#x6574;&#x89C4;&#x683C;&#x53C2;&#x6570;&#x503C;</p>
<pre><code class="lang-python">spec_sku_map = {
    (&#x89C4;&#x683C;<span class="hljs-number">1</span>&#x53C2;&#x6570;id, &#x89C4;&#x683C;<span class="hljs-number">2</span>&#x53C2;&#x6570;id, &#x89C4;&#x683C;<span class="hljs-number">3</span>&#x53C2;&#x6570;id, ...): sku_id,
    (&#x89C4;&#x683C;<span class="hljs-number">1</span>&#x53C2;&#x6570;id, &#x89C4;&#x683C;<span class="hljs-number">2</span>&#x53C2;&#x6570;id, &#x89C4;&#x683C;<span class="hljs-number">3</span>&#x53C2;&#x6570;id, ...): sku_id,
    ...
}
</code></pre>
<p>&#x786E;&#x5B9A;&#x5F53;&#x524D;sku&#x7684;&#x5B8C;&#x6574;&#x89C4;&#x683C;&#x53C2;&#x6570;</p>
<pre><code class="lang-python">sku_key = [&#x89C4;&#x683C;<span class="hljs-number">1</span>&#x53C2;&#x6570;id&#xFF0C; &#x89C4;&#x683C;<span class="hljs-number">2</span>&#x53C2;&#x6570;id&#xFF0C; &#x89C4;&#x683C;<span class="hljs-number">3</span>&#x53C2;&#x6570;id, ...]
</code></pre>
<p>&#x601D;&#x8DEF;&#x56FE;</p>
<p><img src="../images/&#x89C4;&#x683C;&#x53C2;&#x6570;&#x786E;&#x5B9A;&#x56FE;.png" alt="&#x601D;&#x8DEF;&#x56FE;"></p>
<p>&#x5C06;&#x5F62;&#x6210;&#x5546;&#x54C1;&#x7C7B;&#x522B;&#x90E8;&#x5206;&#x7684;&#x6570;&#x636E;&#x5C01;&#x88C5;&#x6210;&#x4E00;&#x4E2A;&#x516C;&#x5171;&#x51FD;&#x6570;&#xFF0C;&#x653E;&#x5728;goods/utils.py&#x4E2D;</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> collections <span class="hljs-keyword">import</span> OrderedDict

<span class="hljs-keyword">from</span> .models <span class="hljs-keyword">import</span> GoodsChannel


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_categories</span><span class="hljs-params">()</span>:</span>
    <span class="hljs-string">&quot;&quot;&quot;
    &#x83B7;&#x53D6;&#x5546;&#x57CE;&#x5546;&#x54C1;&#x5206;&#x7C7B;&#x83DC;&#x5355;
    :return &#x83DC;&#x5355;&#x5B57;&#x5178;
    &quot;&quot;&quot;</span>
    <span class="hljs-comment"># &#x5546;&#x54C1;&#x9891;&#x9053;&#x53CA;&#x5206;&#x7C7B;&#x83DC;&#x5355;</span>
    <span class="hljs-comment"># &#x4F7F;&#x7528;&#x6709;&#x5E8F;&#x5B57;&#x5178;&#x4FDD;&#x5B58;&#x7C7B;&#x522B;&#x7684;&#x987A;&#x5E8F;</span>
    <span class="hljs-comment"># categories = {</span>
    <span class="hljs-comment">#     1: { # &#x7EC4;1</span>
    <span class="hljs-comment">#         &apos;channels&apos;: [{&apos;id&apos;:, &apos;name&apos;:, &apos;url&apos;:},{}, {}...],</span>
    <span class="hljs-comment">#         &apos;sub_cats&apos;: [{&apos;id&apos;:, &apos;name&apos;:, &apos;sub_cats&apos;:[{},{}]}, {}, {}, ..]</span>
    <span class="hljs-comment">#     },</span>
    <span class="hljs-comment">#     2: { # &#x7EC4;2</span>
    <span class="hljs-comment">#</span>
    <span class="hljs-comment">#     }</span>
    <span class="hljs-comment"># }</span>
    categories = OrderedDict()
    channels = GoodsChannel.objects.order_by(<span class="hljs-string">&apos;group_id&apos;</span>, <span class="hljs-string">&apos;sequence&apos;</span>)
    <span class="hljs-keyword">for</span> channel <span class="hljs-keyword">in</span> channels:
        group_id = channel.group_id  <span class="hljs-comment"># &#x5F53;&#x524D;&#x7EC4;</span>

        <span class="hljs-keyword">if</span> group_id <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> categories:
            categories[group_id] = {<span class="hljs-string">&apos;channels&apos;</span>: [], <span class="hljs-string">&apos;sub_cats&apos;</span>: []}

        cat1 = channel.category  <span class="hljs-comment"># &#x5F53;&#x524D;&#x9891;&#x9053;&#x7684;&#x7C7B;&#x522B;</span>

        <span class="hljs-comment"># &#x8FFD;&#x52A0;&#x5F53;&#x524D;&#x9891;&#x9053;</span>
        categories[group_id][<span class="hljs-string">&apos;channels&apos;</span>].append({
            <span class="hljs-string">&apos;id&apos;</span>: cat1.id,
            <span class="hljs-string">&apos;name&apos;</span>: cat1.name,
            <span class="hljs-string">&apos;url&apos;</span>: channel.url
        })
        <span class="hljs-comment"># &#x6784;&#x5EFA;&#x5F53;&#x524D;&#x7C7B;&#x522B;&#x7684;&#x5B50;&#x7C7B;&#x522B;</span>
        <span class="hljs-keyword">for</span> cat2 <span class="hljs-keyword">in</span> cat1.goodscategory_set.all():
            cat2.sub_cats = []
            <span class="hljs-keyword">for</span> cat3 <span class="hljs-keyword">in</span> cat2.goodscategory_set.all():
                cat2.sub_cats.append(cat3)
            categories[group_id][<span class="hljs-string">&apos;sub_cats&apos;</span>].append(cat2)
    <span class="hljs-keyword">return</span> categories
</code></pre>
<p>&#x9875;&#x9762;&#x6A21;&#x677F;</p>
<pre><code class="lang-html"><span class="hljs-doctype">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">html</span> <span class="hljs-attribute">xmlns</span>=<span class="hljs-value">&quot;http://www.w3.org/1999/xhtml&quot;</span> <span class="hljs-attribute">xml:lang</span>=<span class="hljs-value">&quot;en&quot;</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">meta</span> <span class="hljs-attribute">http-equiv</span>=<span class="hljs-value">&quot;Content-Type&quot;</span> <span class="hljs-attribute">content</span>=<span class="hljs-value">&quot;text/html;charset=UTF-8&quot;</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">title</span>&gt;</span>&#x7F8E;&#x591A;&#x5546;&#x57CE;-&#x5546;&#x54C1;&#x8BE6;&#x60C5;<span class="hljs-tag">&lt;/<span class="hljs-title">title</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">link</span> <span class="hljs-attribute">rel</span>=<span class="hljs-value">&quot;stylesheet&quot;</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">&quot;text/css&quot;</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;/css/reset.css&quot;</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">link</span> <span class="hljs-attribute">rel</span>=<span class="hljs-value">&quot;stylesheet&quot;</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">&quot;text/css&quot;</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;/css/main.css&quot;</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">script</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">&quot;text/javascript&quot;</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;/js/host.js&quot;</span>&gt;</span><span class="undefined"></span><span class="hljs-tag">&lt;/<span class="hljs-title">script</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">script</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">&quot;text/javascript&quot;</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;/js/vue-2.5.16.js&quot;</span>&gt;</span><span class="undefined"></span><span class="hljs-tag">&lt;/<span class="hljs-title">script</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">script</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">&quot;text/javascript&quot;</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;/js/axios-0.18.0.min.js&quot;</span>&gt;</span><span class="undefined"></span><span class="hljs-tag">&lt;/<span class="hljs-title">script</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">head</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">id</span>=<span class="hljs-value">&quot;app&quot;</span> <span class="hljs-attribute">v-cloak</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;header_con&quot;</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;header&quot;</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;welcome fl&quot;</span>&gt;</span>&#x6B22;&#x8FCE;&#x6765;&#x5230;&#x7F8E;&#x591A;&#x5546;&#x57CE;!<span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;fr&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">v-if</span>=<span class="hljs-value">&quot;username&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;login_btn fl&quot;</span>&gt;</span>
                    &#x6B22;&#x8FCE;&#x60A8;&#xFF1A;<span class="hljs-tag">&lt;<span class="hljs-title">em</span>&gt;</span>[[ username ]]<span class="hljs-tag">&lt;/<span class="hljs-title">em</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">span</span>&gt;</span>|<span class="hljs-tag">&lt;/<span class="hljs-title">span</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">a</span> @<span class="hljs-attribute">click</span>=<span class="hljs-value">&quot;logout&quot;</span>&gt;</span>&#x9000;&#x51FA;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">v-else</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;login_btn fl&quot;</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;login.html&quot;</span>&gt;</span>&#x767B;&#x5F55;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">span</span>&gt;</span>|<span class="hljs-tag">&lt;/<span class="hljs-title">span</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;register.html&quot;</span>&gt;</span>&#x6CE8;&#x518C;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;user_link fl&quot;</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">span</span>&gt;</span>|<span class="hljs-tag">&lt;/<span class="hljs-title">span</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;/user_center_info.html&quot;</span>&gt;</span>&#x7528;&#x6237;&#x4E2D;&#x5FC3;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">span</span>&gt;</span>|<span class="hljs-tag">&lt;/<span class="hljs-title">span</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;/cart.html&quot;</span>&gt;</span>&#x6211;&#x7684;&#x8D2D;&#x7269;&#x8F66;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">span</span>&gt;</span>|<span class="hljs-tag">&lt;/<span class="hljs-title">span</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;/user_center_order.html&quot;</span>&gt;</span>&#x6211;&#x7684;&#x8BA2;&#x5355;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>

    <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;search_bar clearfix&quot;</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;/index.html&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;logo fl&quot;</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">img</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;/images/logo.png&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;search_wrap fl&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">form</span> <span class="hljs-attribute">method</span>=<span class="hljs-value">&quot;get&quot;</span> <span class="hljs-attribute">action</span>=<span class="hljs-value">&quot;/search.html&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;search_con&quot;</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">input</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">&quot;text&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;input_text fl&quot;</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">&quot;q&quot;</span> <span class="hljs-attribute">placeholder</span>=<span class="hljs-value">&quot;&#x641C;&#x7D22;&#x5546;&#x54C1;&quot;</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">input</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">&quot;submit&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;input_btn fr&quot;</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">&quot;&quot;</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">&quot;&#x641C;&#x7D22;&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">form</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">ul</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;search_suggest fl&quot;</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;#&quot;</span>&gt;</span>&#x7D22;&#x5C3C;&#x5FAE;&#x5355;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;#&quot;</span>&gt;</span>&#x4F18;&#x60E0;15&#x5143;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;#&quot;</span>&gt;</span>&#x7F8E;&#x5986;&#x4E2A;&#x62A4;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;#&quot;</span>&gt;</span>&#x4E70;2&#x514D;1<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">ul</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>

            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;guest_cart fr&quot;</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;#&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;cart_name fl&quot;</span>&gt;</span>&#x6211;&#x7684;&#x8D2D;&#x7269;&#x8F66;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;goods_count fl&quot;</span> <span class="hljs-attribute">id</span>=<span class="hljs-value">&quot;show_count&quot;</span>&gt;</span>15<span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>

            <span class="hljs-tag">&lt;<span class="hljs-title">ul</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;cart_goods_show&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">li</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">img</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;images/goods/goods001.jpg&quot;</span> <span class="hljs-attribute">alt</span>=<span class="hljs-value">&quot;&#x5546;&#x54C1;&#x56FE;&#x7247;&quot;</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">h4</span>&gt;</span>&#x5546;&#x54C1;&#x540D;&#x79F0;&#x624B;&#x673A;<span class="hljs-tag">&lt;/<span class="hljs-title">h4</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">div</span>&gt;</span>4<span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">li</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">img</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;images/goods/goods002.jpg&quot;</span> <span class="hljs-attribute">alt</span>=<span class="hljs-value">&quot;&#x5546;&#x54C1;&#x56FE;&#x7247;&quot;</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">h4</span>&gt;</span>&#x5546;&#x54C1;&#x540D;&#x79F0;&#x624B;&#x673A;<span class="hljs-tag">&lt;/<span class="hljs-title">h4</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">div</span>&gt;</span>5<span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">li</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">img</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;images/goods/goods003.jpg&quot;</span> <span class="hljs-attribute">alt</span>=<span class="hljs-value">&quot;&#x5546;&#x54C1;&#x56FE;&#x7247;&quot;</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">h4</span>&gt;</span>&#x5546;&#x54C1;&#x540D;&#x79F0;&#x624B;&#x673A;<span class="hljs-tag">&lt;/<span class="hljs-title">h4</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">div</span>&gt;</span>6<span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">li</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">img</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;images/goods/goods003.jpg&quot;</span> <span class="hljs-attribute">alt</span>=<span class="hljs-value">&quot;&#x5546;&#x54C1;&#x56FE;&#x7247;&quot;</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">h4</span>&gt;</span>&#x5546;&#x54C1;&#x540D;&#x79F0;&#x624B;&#x673A;<span class="hljs-tag">&lt;/<span class="hljs-title">h4</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">div</span>&gt;</span>6<span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-title">ul</span>&gt;</span>            
        <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>

        <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>

        <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;navbar_con&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;navbar&quot;</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;sub_menu_con fl&quot;</span>&gt;</span>
                        <span class="hljs-tag">&lt;<span class="hljs-title">h1</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;fl&quot;</span>&gt;</span>&#x5546;&#x54C1;&#x5206;&#x7C7B;<span class="hljs-tag">&lt;/<span class="hljs-title">h1</span>&gt;</span>
                        <span class="hljs-tag">&lt;<span class="hljs-title">ul</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;sub_menu&quot;</span>&gt;</span>
                            {% for group in categories.values %}
                            <span class="hljs-tag">&lt;<span class="hljs-title">li</span>&gt;</span>
                                <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;level1&quot;</span>&gt;</span>
                                    {% for channel in group.channels %}
                                    <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;{{ channel.url }}&quot;</span>&gt;</span>{{ channel.name }}<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                                    {% endfor %}
                                <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                                <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;level2&quot;</span>&gt;</span>
                                    {% for cat2 in group.sub_cats %}
                                    <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;list_group&quot;</span>&gt;</span>
                                        <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;group_name fl&quot;</span>&gt;</span>{{cat2.name}} &amp;gt;<span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                                        <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;group_detail fl&quot;</span>&gt;</span>
                                            {% for cat3 in cat2.sub_cats %}
                                            <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;/list.html?cat={{cat3.id}}&quot;</span>&gt;</span>{{cat3.name}}<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                                            {% endfor %}
                                        <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                                    <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                                    {% endfor %}
                                <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                            <span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                            {% endfor %}
                        <span class="hljs-tag">&lt;/<span class="hljs-title">ul</span>&gt;</span>
                    <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>

                    <span class="hljs-tag">&lt;<span class="hljs-title">ul</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;navlist fl&quot;</span>&gt;</span>
                        <span class="hljs-tag">&lt;<span class="hljs-title">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;&quot;</span>&gt;</span>&#x9996;&#x9875;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                        <span class="hljs-tag">&lt;<span class="hljs-title">li</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;interval&quot;</span>&gt;</span>|<span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                        <span class="hljs-tag">&lt;<span class="hljs-title">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;&quot;</span>&gt;</span>&#x771F;&#x5212;&#x7B97;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                        <span class="hljs-tag">&lt;<span class="hljs-title">li</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;interval&quot;</span>&gt;</span>|<span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                        <span class="hljs-tag">&lt;<span class="hljs-title">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;&quot;</span>&gt;</span>&#x62BD;&#x5956;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                    <span class="hljs-tag">&lt;/<span class="hljs-title">ul</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>

    <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;breadcrumb&quot;</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;{{ goods.channel.url }}&quot;</span>&gt;</span>{{ goods.category1.name }}<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">span</span>&gt;</span>&gt;<span class="hljs-tag">&lt;/<span class="hljs-title">span</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">span</span>&gt;</span>{{ goods.category2.name }}<span class="hljs-tag">&lt;/<span class="hljs-title">span</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">span</span>&gt;</span>&gt;<span class="hljs-tag">&lt;/<span class="hljs-title">span</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;/list.html?cat={{ goods.category3.id }}&quot;</span>&gt;</span>{{goods.category3.name }}<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>

    <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;goods_detail_con clearfix&quot;</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;goods_detail_pic fl&quot;</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">img</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;{{ sku.default_image_url }}&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;goods_detail_list fr&quot;</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">h3</span>&gt;</span>{{ sku.name }}<span class="hljs-tag">&lt;/<span class="hljs-title">h3</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">p</span>&gt;</span>{{ sku.caption }}<span class="hljs-tag">&lt;/<span class="hljs-title">p</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;prize_bar&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">span</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;show_pirze&quot;</span>&gt;</span>&#xA5;<span class="hljs-tag">&lt;<span class="hljs-title">em</span>&gt;</span>{{ sku.price }}<span class="hljs-tag">&lt;/<span class="hljs-title">em</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">span</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">span</span>&gt;</span> &#x5E02;&#x573A;&#x4EF7;&#xFFE5;{{sku.market_price}}<span class="hljs-tag">&lt;/<span class="hljs-title">span</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;javascript:;&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;goods_judge&quot;</span>&gt;</span>{{ sku.comments }}&#x4EBA;&#x8BC4;&#x4EF7;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;goods_num clearfix&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;num_name fl&quot;</span>&gt;</span>&#x6570; &#x91CF;&#xFF1A;<span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;num_add fl&quot;</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">input</span> <span class="hljs-attribute">v-model</span>=<span class="hljs-value">&quot;sku_count&quot;</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">&quot;text&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;num_show fl&quot;</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">a</span> @<span class="hljs-attribute">click</span>=<span class="hljs-value">&quot;sku_count++&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;add fr&quot;</span>&gt;</span>+<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">a</span> @<span class="hljs-attribute">click</span>=<span class="hljs-value">&quot;on_minus()&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;minus fr&quot;</span>&gt;</span>-<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
            {% for spec in specs %}
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;type_select&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">label</span>&gt;</span>{{ spec.name }}:<span class="hljs-tag">&lt;/<span class="hljs-title">label</span>&gt;</span>
                {% for option in spec.options %}
                {% if option.sku_id == sku.id %}
                <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;javascript:;&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;select&quot;</span>&gt;</span>{{ option.value }}<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                {% elif option.sku_id %}
                <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;/goods/{{option.sku_id}}.html&quot;</span>&gt;</span>{{ option.value }}<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                {% else %}
                <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;javascript:;&quot;</span>&gt;</span>{{ option.value }}<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                {% endif %}
                {% endfor %}
            <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
            {% endfor %}
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;total&quot;</span>&gt;</span>&#x603B;&#x4EF7;&#xFF1A;<span class="hljs-tag">&lt;<span class="hljs-title">em</span>&gt;</span>[[sku_amount]]&#x5143;<span class="hljs-tag">&lt;/<span class="hljs-title">em</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;operate_btn&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">a</span> @<span class="hljs-attribute">click</span>=<span class="hljs-value">&quot;add_cart&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;add_cart&quot;</span> <span class="hljs-attribute">id</span>=<span class="hljs-value">&quot;add_cart&quot;</span>&gt;</span>&#x52A0;&#x5165;&#x8D2D;&#x7269;&#x8F66;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>

    <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;main_wrap clearfix&quot;</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;l_wrap fl clearfix&quot;</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;new_goods&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">h3</span>&gt;</span>&#x70ED;&#x9500;&#x6392;&#x884C;<span class="hljs-tag">&lt;/<span class="hljs-title">h3</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">ul</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">li</span> <span class="hljs-attribute">v-for</span>=<span class="hljs-value">&quot;sku in hots&quot;</span>&gt;</span>
                        <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">:href</span>=<span class="hljs-value">&quot;sku.url&quot;</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">img</span> <span class="hljs-attribute">:src</span>=<span class="hljs-value">&quot;sku.default_image_url&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
                        <span class="hljs-tag">&lt;<span class="hljs-title">h4</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">:href</span>=<span class="hljs-value">&quot;sku.url&quot;</span>&gt;</span>[[sku.name]]<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">h4</span>&gt;</span>
                        <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;prize&quot;</span>&gt;</span>&#xFFE5;[[sku.price]]<span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                    <span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">ul</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>

        <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;r_wrap fr clearfix&quot;</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">ul</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;detail_tab clearfix&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">li</span> @<span class="hljs-attribute">click</span>=<span class="hljs-value">&quot;on_tab_content(&apos;detail&apos;)&quot;</span> <span class="hljs-attribute">:class</span>=<span class="hljs-value">&quot;tab_content.detail?&apos;active&apos;:&apos;&apos;&quot;</span>&gt;</span>&#x5546;&#x54C1;&#x8BE6;&#x60C5;<span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">li</span> @<span class="hljs-attribute">click</span>=<span class="hljs-value">&quot;on_tab_content(&apos;pack&apos;)&quot;</span> <span class="hljs-attribute">:class</span>=<span class="hljs-value">&quot;tab_content.pack?&apos;active&apos;:&apos;&apos;&quot;</span>&gt;</span>&#x89C4;&#x683C;&#x4E0E;&#x5305;&#x88C5;<span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">li</span> @<span class="hljs-attribute">click</span>=<span class="hljs-value">&quot;on_tab_content(&apos;comment&apos;)&quot;</span> <span class="hljs-attribute">:class</span>=<span class="hljs-value">&quot;tab_content.comment?&apos;active&apos;:&apos;&apos;&quot;</span>&gt;</span>&#x5546;&#x54C1;&#x8BC4;&#x4EF7;([[comments.length]])<span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">li</span> @<span class="hljs-attribute">click</span>=<span class="hljs-value">&quot;on_tab_content(&apos;service&apos;)&quot;</span> <span class="hljs-attribute">:class</span>=<span class="hljs-value">&quot;tab_content.service?&apos;active&apos;:&apos;&apos;&quot;</span>&gt;</span>&#x552E;&#x540E;&#x670D;&#x52A1;<span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-title">ul</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> @<span class="hljs-attribute">click</span>=<span class="hljs-value">&quot;on_tab_content(&apos;detail&apos;)&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;tab_content&quot;</span> <span class="hljs-attribute">:class</span>=<span class="hljs-value">&quot;tab_content.detail?&apos;current&apos;:&apos;&apos;&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">dl</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">dt</span>&gt;</span>&#x5546;&#x54C1;&#x8BE6;&#x60C5;&#xFF1A;<span class="hljs-tag">&lt;/<span class="hljs-title">dt</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">dd</span>&gt;</span>{{ goods.desc_detail|safe }}<span class="hljs-tag">&lt;/<span class="hljs-title">dd</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">dl</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> @<span class="hljs-attribute">click</span>=<span class="hljs-value">&quot;on_tab_content(&apos;pack&apos;)&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;tab_content&quot;</span> <span class="hljs-attribute">:class</span>=<span class="hljs-value">&quot;tab_content.pack?&apos;current&apos;:&apos;&apos;&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">dl</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">dt</span>&gt;</span>&#x89C4;&#x683C;&#x4E0E;&#x5305;&#x88C5;&#xFF1A;<span class="hljs-tag">&lt;/<span class="hljs-title">dt</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">dd</span>&gt;</span>{{ goods.desc_pack|safe }}<span class="hljs-tag">&lt;/<span class="hljs-title">dd</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">dl</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> @<span class="hljs-attribute">click</span>=<span class="hljs-value">&quot;on_tab_content(&apos;comment&apos;)&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;tab_content&quot;</span> <span class="hljs-attribute">:class</span>=<span class="hljs-value">&quot;tab_content.comment?&apos;current&apos;:&apos;&apos;&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">ul</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;judge_list_con&quot;</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">li</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;judge_list fl&quot;</span> <span class="hljs-attribute">v-for</span>=<span class="hljs-value">&quot;comment in comments&quot;</span>&gt;</span>
                        <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;user_info fl&quot;</span>&gt;</span>
                            <span class="hljs-tag">&lt;<span class="hljs-title">b</span>&gt;</span>[[comment.username]]<span class="hljs-tag">&lt;/<span class="hljs-title">b</span>&gt;</span>
                        <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                        <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;judge_info fl&quot;</span>&gt;</span>
                            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">:class</span>=<span class="hljs-value">&quot;comment.score_class&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;judge_detail&quot;</span>&gt;</span>[[comment.comment]]<span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                        <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
                    <span class="hljs-tag">&lt;/<span class="hljs-title">li</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">ul</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">div</span> @<span class="hljs-attribute">click</span>=<span class="hljs-value">&quot;on_tab_content(&apos;service&apos;)&quot;</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;tab_content&quot;</span> <span class="hljs-attribute">:class</span>=<span class="hljs-value">&quot;tab_content.service?&apos;current&apos;:&apos;&apos;&quot;</span>&gt;</span>
                <span class="hljs-tag">&lt;<span class="hljs-title">dl</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">dt</span>&gt;</span>&#x552E;&#x540E;&#x670D;&#x52A1;&#xFF1A;<span class="hljs-tag">&lt;/<span class="hljs-title">dt</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-title">dd</span>&gt;</span>{{ goods.desc_service|safe }}<span class="hljs-tag">&lt;/<span class="hljs-title">dd</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-title">dl</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>



        <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>

    <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;footer&quot;</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">&quot;foot_link&quot;</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;#&quot;</span>&gt;</span>&#x5173;&#x4E8E;&#x6211;&#x4EEC;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">span</span>&gt;</span>|<span class="hljs-tag">&lt;/<span class="hljs-title">span</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;#&quot;</span>&gt;</span>&#x8054;&#x7CFB;&#x6211;&#x4EEC;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">span</span>&gt;</span>|<span class="hljs-tag">&lt;/<span class="hljs-title">span</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;#&quot;</span>&gt;</span>&#x62DB;&#x8058;&#x4EBA;&#x624D;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">span</span>&gt;</span>|<span class="hljs-tag">&lt;/<span class="hljs-title">span</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">&quot;#&quot;</span>&gt;</span>&#x53CB;&#x60C5;&#x94FE;&#x63A5;<span class="hljs-tag">&lt;/<span class="hljs-title">a</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">p</span>&gt;</span>CopyRight &#xA9; 2016 &#x5317;&#x4EAC;&#x7F8E;&#x591A;&#x5546;&#x4E1A;&#x80A1;&#x4EFD;&#x6709;&#x9650;&#x516C;&#x53F8; All Rights Reserved<span class="hljs-tag">&lt;/<span class="hljs-title">p</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-title">p</span>&gt;</span>&#x7535;&#x8BDD;&#xFF1A;010-****888    &#x4EAC;ICP&#x5907;*******8&#x53F7;<span class="hljs-tag">&lt;/<span class="hljs-title">p</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">script</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">&quot;text/javascript&quot;</span>&gt;</span><span class="handlebars"><span class="xml">
        var price = </span><span class="hljs-expression">{{<span class="hljs-variable">sku.price</span>}}</span><span class="xml">;
        var cat = </span><span class="hljs-expression">{{ <span class="hljs-variable">goods.category</span>3<span class="hljs-variable">.id</span> }}</span><span class="xml">;
    </span></span><span class="hljs-tag">&lt;/<span class="hljs-title">script</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-title">script</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">&quot;text/javascript&quot;</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">&quot;/js/detail.js&quot;</span>&gt;</span><span class="undefined"></span><span class="hljs-tag">&lt;/<span class="hljs-title">script</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-title">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">html</span>&gt;</span>
</code></pre>
<p>&#x9875;&#x9762;&#x7684;detail.js</p>
<pre><code class="lang-js"><span class="hljs-keyword">var</span> vm = <span class="hljs-keyword">new</span> Vue({
    el: <span class="hljs-string">&apos;#app&apos;</span>,
    delimiters: [<span class="hljs-string">&apos;[[&apos;</span>, <span class="hljs-string">&apos;]]&apos;</span>],
    data: {
        host,
        username: sessionStorage.username || localStorage.username,
        user_id: sessionStorage.user_id || localStorage.user_id,
        token: sessionStorage.token || localStorage.token,
        tab_content: {
            detail: <span class="hljs-literal">true</span>,
            pack: <span class="hljs-literal">false</span>,
            comment: <span class="hljs-literal">false</span>,
            service: <span class="hljs-literal">false</span>
        },
        sku_id: <span class="hljs-string">&apos;&apos;</span>,
        sku_count: <span class="hljs-number">1</span>,
        sku_price: price,
        cart_total_count: <span class="hljs-number">0</span>, <span class="hljs-comment">// &#x8D2D;&#x7269;&#x8F66;&#x603B;&#x6570;&#x91CF;</span>
        cart: [], <span class="hljs-comment">// &#x8D2D;&#x7269;&#x8F66;&#x6570;&#x636E;</span>
        hots: [], <span class="hljs-comment">// &#x70ED;&#x9500;&#x5546;&#x54C1;</span>
        cat: cat, <span class="hljs-comment">// &#x5546;&#x54C1;&#x7C7B;&#x522B;</span>
        comments: [], <span class="hljs-comment">// &#x8BC4;&#x8BBA;&#x4FE1;&#x606F;</span>
        score_classes: {
            <span class="hljs-number">1</span>: <span class="hljs-string">&apos;stars_one&apos;</span>,
            <span class="hljs-number">2</span>: <span class="hljs-string">&apos;stars_two&apos;</span>,
            <span class="hljs-number">3</span>: <span class="hljs-string">&apos;stars_three&apos;</span>,
            <span class="hljs-number">4</span>: <span class="hljs-string">&apos;stars_four&apos;</span>,
            <span class="hljs-number">5</span>: <span class="hljs-string">&apos;stars_five&apos;</span>,
        }
    },
    computed: {
        sku_amount: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
            <span class="hljs-keyword">return</span> (<span class="hljs-keyword">this</span>.sku_price * <span class="hljs-keyword">this</span>.sku_count).toFixed(<span class="hljs-number">2</span>);
        }
    },
    mounted: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
        <span class="hljs-comment">// &#x6DFB;&#x52A0;&#x7528;&#x6237;&#x6D4F;&#x89C8;&#x5386;&#x53F2;&#x8BB0;&#x5F55;</span>
        <span class="hljs-keyword">this</span>.get_sku_id();

        <span class="hljs-keyword">this</span>.get_cart();
        <span class="hljs-keyword">this</span>.get_hot_goods();
        <span class="hljs-keyword">this</span>.get_comments();
    },
    methods: {
        <span class="hljs-comment">// &#x9000;&#x51FA;</span>
        logout: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
            sessionStorage.clear();
            localStorage.clear();
            location.href = <span class="hljs-string">&apos;/login.html&apos;</span>;
        },
        <span class="hljs-comment">// &#x63A7;&#x5236;&#x9875;&#x9762;&#x6807;&#x7B7E;&#x9875;&#x5C55;&#x793A;</span>
        on_tab_content: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">name</span>)</span>{
            <span class="hljs-keyword">this</span>.tab_content = {
                detail: <span class="hljs-literal">false</span>,
                pack: <span class="hljs-literal">false</span>,
                comment: <span class="hljs-literal">false</span>,
                service: <span class="hljs-literal">false</span>
            };
            <span class="hljs-keyword">this</span>.tab_content[name] = <span class="hljs-literal">true</span>;
        },
        <span class="hljs-comment">// &#x4ECE;&#x8DEF;&#x5F84;&#x4E2D;&#x63D0;&#x53D6;sku_id</span>
        get_sku_id: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
            <span class="hljs-keyword">var</span> re = <span class="hljs-regexp">/^\/goods\/(\d+).html$/</span>;
            <span class="hljs-keyword">this</span>.sku_id = <span class="hljs-built_in">document</span>.location.pathname.match(re)[<span class="hljs-number">1</span>];
        },
        <span class="hljs-comment">// &#x51CF;&#x5C0F;&#x6570;&#x503C;</span>
        on_minus: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
            <span class="hljs-keyword">if</span> (<span class="hljs-keyword">this</span>.sku_count &gt; <span class="hljs-number">1</span>) {
                <span class="hljs-keyword">this</span>.sku_count--;
            }
        },
        <span class="hljs-comment">// &#x6DFB;&#x52A0;&#x8D2D;&#x7269;&#x8F66;</span>
        add_cart: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{

        },
        <span class="hljs-comment">// &#x83B7;&#x53D6;&#x8D2D;&#x7269;&#x8F66;&#x6570;&#x636E;</span>
        get_cart: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{

        },
        <span class="hljs-comment">// &#x83B7;&#x53D6;&#x70ED;&#x9500;&#x5546;&#x54C1;&#x6570;&#x636E;</span>
        get_hot_goods: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{

        },
        <span class="hljs-comment">// &#x83B7;&#x53D6;&#x5546;&#x54C1;&#x8BC4;&#x4EF7;&#x4FE1;&#x606F;</span>
        get_comments: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{

        }
    }
});
</code></pre>
<h3 id="&#x5F02;&#x6B65;&#x4EFB;&#x52A1;&#x7684;&#x89E6;&#x53D1;">&#x5F02;&#x6B65;&#x4EFB;&#x52A1;&#x7684;&#x89E6;&#x53D1;</h3>
<p>&#x8FD0;&#x8425;&#x4EBA;&#x5458;&#x5728;Admin&#x7AD9;&#x70B9;&#x4FDD;&#x5B58;&#x5546;&#x54C1;&#x4FE1;&#x606F;&#x65F6;&#xFF0C;&#x5E94;&#x8BE5;&#x89E6;&#x53D1;&#x751F;&#x6210;&#x5546;&#x54C1;&#x9759;&#x6001;&#x9875;&#x7684;&#x5F02;&#x6B65;&#x4EFB;&#x52A1;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x9700;&#x8981;&#x8C03;&#x6574;Admin&#x7AD9;&#x70B9;&#x4FDD;&#x5B58;&#x548C;&#x5220;&#x9664;&#x5546;&#x54C1;&#x4FE1;&#x606F;&#x65F6;&#x884C;&#x4E3A;&#x3002;</p>
<p>&#x5728;Admin&#x7AD9;&#x70B9;&#x4FDD;&#x5B58;&#x6216;&#x5220;&#x9664;&#x6570;&#x636E;&#x65F6;&#xFF0C;Django&#x662F;&#x8C03;&#x7528;&#x7684;Admin&#x7AD9;&#x70B9;&#x7BA1;&#x7406;&#x5668;&#x7C7B;&#x7684;<strong>save_model()</strong>&#x65B9;&#x6CD5;&#x548C;<strong>delete_model()</strong>&#x65B9;&#x6CD5;&#xFF0C;&#x6211;&#x4EEC;&#x53EA;&#x9700;&#x91CD;&#x65B0;&#x5B9E;&#x73B0;&#x8FD9;&#x4E24;&#x4E2A;&#x65B9;&#x6CD5;&#xFF0C;&#x5728;&#x8FD9;&#x4E24;&#x4E2A;&#x65B9;&#x6CD5;&#x4E2D;&#x8C03;&#x7528;&#x5F02;&#x6B65;&#x4EFB;&#x52A1;&#x5373;&#x53EF;&#x3002;</p>
<p>&#x7F16;&#x8F91;goods/admin.py</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> django.contrib <span class="hljs-keyword">import</span> admin

<span class="hljs-comment"># Register your models here.</span>

<span class="hljs-keyword">from</span> . <span class="hljs-keyword">import</span> models


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SKUAdmin</span><span class="hljs-params">(admin.ModelAdmin)</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">save_model</span><span class="hljs-params">(self, request, obj, form, change)</span>:</span>
        obj.save()
        <span class="hljs-keyword">from</span> celery_tasks.html.tasks <span class="hljs-keyword">import</span> generate_static_sku_detail_html
        generate_static_sku_detail_html.delay(obj.id)


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SKUSpecificationAdmin</span><span class="hljs-params">(admin.ModelAdmin)</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">save_model</span><span class="hljs-params">(self, request, obj, form, change)</span>:</span>
        obj.save()
        <span class="hljs-keyword">from</span> celery_tasks.html.tasks <span class="hljs-keyword">import</span> generate_static_sku_detail_html
        generate_static_sku_detail_html.delay(obj.sku.id)

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">delete_model</span><span class="hljs-params">(self, request, obj)</span>:</span>
        sku_id = obj.sku.id
        obj.delete()
        <span class="hljs-keyword">from</span> celery_tasks.html.tasks <span class="hljs-keyword">import</span> generate_static_sku_detail_html
        generate_static_sku_detail_html.delay(sku_id)


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SKUImageAdmin</span><span class="hljs-params">(admin.ModelAdmin)</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">save_model</span><span class="hljs-params">(self, request, obj, form, change)</span>:</span>
        obj.save()
        <span class="hljs-keyword">from</span> celery_tasks.html.tasks <span class="hljs-keyword">import</span> generate_static_sku_detail_html
        generate_static_sku_detail_html.delay(obj.sku.id)

        <span class="hljs-comment"># &#x8BBE;&#x7F6E;SKU&#x9ED8;&#x8BA4;&#x56FE;&#x7247;</span>
        sku = obj.sku
        <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> sku.default_image_url:
            sku.default_image_url = obj.image.url
            sku.save()

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">delete_model</span><span class="hljs-params">(self, request, obj)</span>:</span>
        sku_id = obj.sku.id
        obj.delete()
        <span class="hljs-keyword">from</span> celery_tasks.html.tasks <span class="hljs-keyword">import</span> generate_static_sku_detail_html
        generate_static_sku_detail_html.delay(sku_id)


admin.site.register(models.GoodsCategory)
admin.site.register(models.GoodsChannel)
admin.site.register(models.Goods)
admin.site.register(models.Brand)
admin.site.register(models.GoodsSpecification)
admin.site.register(models.SpecificationOption)
admin.site.register(models.SKU, SKUAdmin)
admin.site.register(models.SKUSpecification, SKUSpecificationAdmin)
admin.site.register(models.SKUImage, SKUImageAdmin)
</code></pre>
<h3 id="&#x811A;&#x672C;&#x5DE5;&#x5177;">&#x811A;&#x672C;&#x5DE5;&#x5177;</h3>
<p>&#x4E3A;&#x4E86;&#x5F00;&#x53D1;&#x65B9;&#x4FBF;&#xFF0C;&#x6211;&#x4EEC;&#x8FD8;&#x53EF;&#x4EE5;&#x7F16;&#x5199;&#x624B;&#x52A8;&#x751F;&#x6210;&#x6240;&#x6709;&#x5546;&#x54C1;&#x9759;&#x6001;&#x9875;&#x9762;&#x7684;&#x811A;&#x672C;regenerate_detail_html.py</p>
<pre><code class="lang-python"><span class="hljs-comment">#!/usr/bin/env python</span>

<span class="hljs-string">&quot;&quot;&quot;
&#x529F;&#x80FD;&#xFF1A;&#x624B;&#x52A8;&#x751F;&#x6210;&#x6240;&#x6709;SKU&#x7684;&#x9759;&#x6001;detail html&#x6587;&#x4EF6;
&#x4F7F;&#x7528;&#x65B9;&#x6CD5;:
    ./regenerate_detail_html.py
&quot;&quot;&quot;</span>
<span class="hljs-keyword">import</span> sys
sys.path.insert(<span class="hljs-number">0</span>, <span class="hljs-string">&apos;../&apos;</span>)
sys.path.insert(<span class="hljs-number">0</span>, <span class="hljs-string">&apos;../meiduo_mall/apps&apos;</span>)

<span class="hljs-keyword">import</span> os
<span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> os.getenv(<span class="hljs-string">&apos;DJANGO_SETTINGS_MODULE&apos;</span>):
    os.environ[<span class="hljs-string">&apos;DJANGO_SETTINGS_MODULE&apos;</span>] = <span class="hljs-string">&apos;meiduo_mall.settings.dev&apos;</span>

<span class="hljs-keyword">import</span> django
django.setup()

<span class="hljs-keyword">from</span> django.template <span class="hljs-keyword">import</span> loader
<span class="hljs-keyword">from</span> django.conf <span class="hljs-keyword">import</span> settings

<span class="hljs-keyword">from</span> goods.utils <span class="hljs-keyword">import</span> get_categories
<span class="hljs-keyword">from</span> goods.models <span class="hljs-keyword">import</span> SKU


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">generate_static_sku_detail_html</span><span class="hljs-params">(sku_id)</span>:</span>
    <span class="hljs-string">&quot;&quot;&quot;
    &#x751F;&#x6210;&#x9759;&#x6001;&#x5546;&#x54C1;&#x8BE6;&#x60C5;&#x9875;&#x9762;
    :param sku_id: &#x5546;&#x54C1;sku id
    &quot;&quot;&quot;</span>
    <span class="hljs-comment"># &#x5546;&#x54C1;&#x5206;&#x7C7B;&#x83DC;&#x5355;</span>
    categories = get_categories()

    <span class="hljs-comment"># &#x83B7;&#x53D6;&#x5F53;&#x524D;sku&#x7684;&#x4FE1;&#x606F;</span>
    sku = SKU.objects.get(id=sku_id)
    sku.images = sku.skuimage_set.all()

    <span class="hljs-comment"># &#x9762;&#x5305;&#x5C51;&#x5BFC;&#x822A;&#x4FE1;&#x606F;&#x4E2D;&#x7684;&#x9891;&#x9053;</span>
    goods = sku.goods
    goods.channel = goods.category1.goodschannel_set.all()[<span class="hljs-number">0</span>]

    <span class="hljs-comment"># &#x6784;&#x5EFA;&#x5F53;&#x524D;&#x5546;&#x54C1;&#x7684;&#x89C4;&#x683C;&#x952E;</span>
    sku_specs = sku.skuspecification_set.order_by(<span class="hljs-string">&apos;spec_id&apos;</span>)
    sku_key = []
    <span class="hljs-keyword">for</span> spec <span class="hljs-keyword">in</span> sku_specs:
        sku_key.append(spec.option.id)

    <span class="hljs-comment"># &#x83B7;&#x53D6;&#x5F53;&#x524D;&#x5546;&#x54C1;&#x7684;&#x6240;&#x6709;SKU</span>
    skus = goods.sku_set.all()

    <span class="hljs-comment"># &#x6784;&#x5EFA;&#x4E0D;&#x540C;&#x89C4;&#x683C;&#x53C2;&#x6570;&#xFF08;&#x9009;&#x9879;&#xFF09;&#x7684;sku&#x5B57;&#x5178;</span>
    <span class="hljs-comment"># spec_sku_map = {</span>
    <span class="hljs-comment">#     (&#x89C4;&#x683C;1&#x53C2;&#x6570;id, &#x89C4;&#x683C;2&#x53C2;&#x6570;id, &#x89C4;&#x683C;3&#x53C2;&#x6570;id, ...): sku_id,</span>
    <span class="hljs-comment">#     (&#x89C4;&#x683C;1&#x53C2;&#x6570;id, &#x89C4;&#x683C;2&#x53C2;&#x6570;id, &#x89C4;&#x683C;3&#x53C2;&#x6570;id, ...): sku_id,</span>
    <span class="hljs-comment">#     ...</span>
    <span class="hljs-comment"># }</span>
    spec_sku_map = {}
    <span class="hljs-keyword">for</span> s <span class="hljs-keyword">in</span> skus:
        <span class="hljs-comment"># &#x83B7;&#x53D6;sku&#x7684;&#x89C4;&#x683C;&#x53C2;&#x6570;</span>
        s_specs = s.skuspecification_set.order_by(<span class="hljs-string">&apos;spec_id&apos;</span>)
        <span class="hljs-comment"># &#x7528;&#x4E8E;&#x5F62;&#x6210;&#x89C4;&#x683C;&#x53C2;&#x6570;-sku&#x5B57;&#x5178;&#x7684;&#x952E;</span>
        key = []
        <span class="hljs-keyword">for</span> spec <span class="hljs-keyword">in</span> s_specs:
            key.append(spec.option.id)
        <span class="hljs-comment"># &#x5411;&#x89C4;&#x683C;&#x53C2;&#x6570;-sku&#x5B57;&#x5178;&#x6DFB;&#x52A0;&#x8BB0;&#x5F55;</span>
        spec_sku_map[tuple(key)] = s.id

    <span class="hljs-comment"># &#x83B7;&#x53D6;&#x5F53;&#x524D;&#x5546;&#x54C1;&#x7684;&#x89C4;&#x683C;&#x4FE1;&#x606F;</span>
    specs = goods.goodsspecification_set.order_by(<span class="hljs-string">&apos;id&apos;</span>)
    <span class="hljs-comment"># &#x82E5;&#x5F53;&#x524D;sku&#x7684;&#x89C4;&#x683C;&#x4FE1;&#x606F;&#x4E0D;&#x5B8C;&#x6574;&#xFF0C;&#x5219;&#x4E0D;&#x518D;&#x7EE7;&#x7EED;</span>
    <span class="hljs-keyword">if</span> len(sku_key) &lt; len(specs):
        <span class="hljs-keyword">return</span>
    <span class="hljs-keyword">for</span> index, spec <span class="hljs-keyword">in</span> enumerate(specs):
        <span class="hljs-comment"># &#x590D;&#x5236;&#x5F53;&#x524D;sku&#x7684;&#x89C4;&#x683C;&#x952E;</span>
        key = sku_key[:]
        <span class="hljs-comment"># &#x8BE5;&#x89C4;&#x683C;&#x7684;&#x9009;&#x9879;</span>
        options = spec.specificationoption_set.all()
        <span class="hljs-keyword">for</span> option <span class="hljs-keyword">in</span> options:
            <span class="hljs-comment"># &#x5728;&#x89C4;&#x683C;&#x53C2;&#x6570;sku&#x5B57;&#x5178;&#x4E2D;&#x67E5;&#x627E;&#x7B26;&#x5408;&#x5F53;&#x524D;&#x89C4;&#x683C;&#x7684;sku</span>
            key[index] = option.id
            option.sku_id = spec_sku_map.get(tuple(key))

        spec.options = options

    <span class="hljs-comment"># &#x6E32;&#x67D3;&#x6A21;&#x677F;&#xFF0C;&#x751F;&#x6210;&#x9759;&#x6001;html&#x6587;&#x4EF6;</span>
    context = {
        <span class="hljs-string">&apos;categories&apos;</span>: categories,
        <span class="hljs-string">&apos;goods&apos;</span>: goods,
        <span class="hljs-string">&apos;specs&apos;</span>: specs,
        <span class="hljs-string">&apos;sku&apos;</span>: sku
    }

    template = loader.get_template(<span class="hljs-string">&apos;detail.html&apos;</span>)
    html_text = template.render(context)
    file_path = os.path.join(settings.GENERATED_STATIC_HTML_FILES_DIR, <span class="hljs-string">&apos;goods/&apos;</span>+str(sku_id)+<span class="hljs-string">&apos;.html&apos;</span>)
    <span class="hljs-keyword">with</span> open(file_path, <span class="hljs-string">&apos;w&apos;</span>) <span class="hljs-keyword">as</span> f:
        f.write(html_text)


<span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">&apos;__main__&apos;</span>:
    skus = SKU.objects.all()
    <span class="hljs-keyword">for</span> sku <span class="hljs-keyword">in</span> skus:
        print(sku.id)
        generate_static_sku_detail_html(sku.id)
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../C03-Goods/GenerateIndexHTMLScript.html" class="navigation navigation-prev " aria-label="Previous page: 静态化首页的手动脚本"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../C03-Goods/HotSaleGoods.html" class="navigation navigation-next " aria-label="Next page: 热销商品"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
